import java.io.*;

public class Save {
    public static void save(Object o,String name)
    {
        try
        {
            FileOutputStream fileInputStream = new FileOutputStream(new File(name+".obj"));
            ObjectOutputStream stream = new ObjectOutputStream(fileInputStream);
            stream.writeObject(o);
            stream.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    public static Object read(String name)
    {
        Object ret=null;
        try
        {
            FileInputStream fileInputStream = new FileInputStream(new File(name+".obj"));
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            ret=objectInputStream.readObject();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return ret;
    }

}
